<!--
 * @Description: Description
 * @Author: zhaojiansen
 * @Date: 2022-11-14 17:04:28
 * @LastEditors: zhaojiansen
 * @LastEditTime: 2022-11-22 14:12:47
-->
<template>
  <div class="creatinglabel">
    <div class="creatinglabelHeight">创建标签基础信息与标签规则</div>

    <el-form
      :model="ruleForm"
      :rules="rules"
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm"
    >
        <div class="header">
      <img src="" alt="" />
      <div>基础信息</div>
    </div>
      <el-form-item label="活动名称" prop="name">
        <el-input v-model="ruleForm.name"></el-input>
      </el-form-item>
      <el-form-item label="活动区域" prop="region">
        <el-select v-model="ruleForm.region" placeholder="请选择活动区域">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="活动形式" prop="desc">
        <el-input type="textarea" v-model="ruleForm.desc"></el-input>
      </el-form-item>
<div class="header">
      <img src="" alt="" />
      <div>标签规则</div>
</div>

<el-form-item>

    </el-form-item>


      <el-form-item>


        <el-button type="primary" @click="submitForm('ruleForm')"
          >立即创建</el-button
        >
        <el-button @click="resetForm('ruleForm')" plain>重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ruleForm: {
        name: "",
        region: "",
        desc: "",
        attributeType:1,
      },
      rules: {
        name: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
        ],
        region: [
          { required: true, message: "请选择活动区域", trigger: "change" },
        ],
      },
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
  },
  resetForm(formName) {
    this.$refs[formName].resetFields();
  },
};
</script>

<style lang="scss" scoped>
.creatinglabel {
  .header {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 3px;
      background-color: #082aff;
      margin-right: 5px;
    }
    div {
      font-size: 15px;
      font-weight: 900;
    }
  }
}
</style>
